namespace DeviceCommons.DeviceMessages.Factories
{
    /// <summary>
    /// 状态工厂注册中心接口
    /// </summary>
    public interface IStateFactoryRegistry
    {
        /// <summary>
        /// 注册状态工厂
        /// </summary>
        /// <param name="deviceType">设备类型</param>
        /// <param name="factoryCreator">工厂创建器</param>
        void RegisterFactory(byte deviceType, Func<IStateFactory> factoryCreator);

        /// <summary>
        /// 获取状态工厂
        /// </summary>
        /// <param name="deviceType">设备类型</param>
        /// <returns>状态工厂实例</returns>
        IStateFactory GetFactory(byte deviceType);

        /// <summary>
        /// 清空工厂缓存
        /// </summary>
        void ClearCache();

        /// <summary>
        /// 检查是否已注册指定设备类型的工厂
        /// </summary>
        /// <param name="deviceType">设备类型</param>
        /// <returns>是否已注册</returns>
        bool IsRegistered(byte deviceType);
    }
}